from pydantic import BaseModel, Field


class OrderCheckoutInput(BaseModel):
    """订单核算"""
    mode: str = Field(..., description="结算模式(buyNow立即购买 cart购物车)")
    delivery: int = Field(..., description="配送方式(10快递配送 20上门自提)")
    shopId: int = Field(..., description="自提门店ID")
    couponId: int = Field(..., description="优惠券ID")
    isUsePoints: int = Field(..., description="是否使用积分抵扣(1使用 0不使用)")
    cartIds: str = Field(..., description="购物车ID集")

class OrderCheckoutOut(BaseModel):
    orderId: int
    payType: int
    payment: list
    class Config:
        orm_mode = True 


class OrderGoods(BaseModel):
    order_goods_id: int
    goods_id: int
    goods_name: str
    image_id: int
    deduct_stock_type: int
    spec_type: int
    goods_sku_id: str
    goods_no: str
    goods_price: str
    line_price: str
    goods_weight: float
    is_user_grade: int
    grade_ratio: int
    grade_goods_price: str
    grade_total_money: str
    coupon_money: str
    points_money: str
    points_num: int
    points_bonus: int
    total_num: int
    total_price: str
    total_pay_price: str
    is_comment: int
    order_id: int
    user_id: int
    goods_source_id: int
    goods_image: str

class OrderResponse(BaseModel):
    order_id: int
    order_no: str
    total_price: str
    order_price: str
    coupon_id: int
    coupon_money: str
    points_money: str
    points_num: int
    pay_price: str
    buyer_remark: str
    pay_type: int
    pay_status: int
    pay_time: str
    delivery_type: int
    express_price: str
    express_id: int
    express_company: str
    express_no: str
    delivery_status: int
    delivery_time: str
    receipt_status: int
    receipt_time: str
    order_status: int
    points_bonus: int
    is_settled: int
    transaction_id: str
    is_comment: int
    order_source: int
    order_source_id: int
    platform: str
    user_id: int
    is_delete: int
    create_time: str
    isAllowRefund: bool
    state_text: str

class OrderData(BaseModel):
    order: OrderResponse

class OrderDetailResp(BaseModel):
    status: int = Field(default=200)
    message: str = Field(default="success")
    data: OrderData